import 'dart:io';
import 'package:flutter/material.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:get/get.dart';
import 'main_controller.dart';
import 'menu.dart';
import 'options.dart';
import 'files_view.dart';
import 'info_view.dart';
import 'thumb_view.dart';
import 'bottom_bar.dart';

void main() {

  Get.put(MainController());
  runApp(const MyApp());

  if (Platform.isWindows) {
    doWhenWindowReady(() {
      final win = appWindow;
      const initialSize = Size(1200, 800);
      win.minSize = initialSize;
      win.size = initialSize;
      win.alignment = Alignment.center;
      win.title = "ColaTeaRenamEXif";
      win.show();
    });
  }

}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      // checkerboardRasterCacheImages: true,
      // debugShowMaterialGrid: true,
      debugShowCheckedModeBanner: false,
      theme: ThemeData( fontFamily: "HarmonyOS_Sans"),
      home: const Home(),
    );
  }
}

// 布局
class Home extends StatelessWidget {
  const Home({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          const SizedBox(height: 60, child: Menu()),
          const Divider(height: 1),
          const SizedBox(height: 40, child: Options()),
          const Divider(height: 1),
          Expanded(child: Row(
            children: [
              const Expanded(flex: 65, child: FilesView()),
              const VerticalDivider(width: 1),
              Expanded(
                flex: 35,
                child: Column(children: const [
                  Expanded(flex: 7, child: InfoView()),
                  Divider(height: 1),
                  Expanded(flex: 3, child: ThumbView())
                ])
              )
            ],
          )),
          const Divider(height: 1),
          const SizedBox(height: 30, child: BottomBar()),
      ])
    );
  }
}
